<?php $this->load->view('common/cms-head'); ?>
<article id="content">
    <div class="pgwrapper">
    <div class="w960 bg1 p15 bx_shw">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="20%" style="border-right: 2px solid #e5e5e5;" valign="top">
		<?php $this->load->view('enterprises/leftnavCMS'); ?>
		</td>
		<td width="80%" valign="top"><form enctype="multipart/form-data"
				action="/addCategory" onsubmit="return validateForm()"  method="POST">
				<table width="100%" border="0" cellpadding="5" cellspacing="0"
					style="padding-left: 20px;">
						</td>
						</tr>
					<tr>
						<td class="txt-blck">Select Parent Category:</td>
						<td><select id="category_parent" name="category_parent" class="setBgInput" style="width:130px;padding-top:5px;">
								<option value="">Select</option>
								<?php foreach($parentCat as $temp){?>
								<option value="<?php echo $temp['parent_id'];?>"><?php echo $temp['parent_name'];?></option>
								<?php }?>
						</select></td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Category Name:</td>
						<td width="70%"><input type="text" onblur="makeURLCategory(this)" value="" name="category_name"
							id="category_name" class="setBgInput"   />
						</td>
					</tr>
                
					<tr>
						<td class="txt-blck" width="30%">Category Url:</td>
						<td width="70%"><input type="text" value="" name="category_url"
							id="category_url" class="setBgInput"   />
						</td>
					</tr>
                    <tr>
						<td class="txt-blck">Category Status:</td>
						<td><select id="category_status" name="category_status" class="setBgInput" style="width:90px;padding-top:5px;">
								<option value="Yes">Yes</option>
								<option value="No">No</option>
						</select></td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Category Image:</td>
						<td width="70%"><input type="file" value="" name="category_image"
							id="image" class="setBgInput"   />
						</td>
					</tr>
                    <tr>
						<td valign="top" class="txt-blck">Category Description:</td>
						<td><textarea style="width: 450px; height: 300px;" class="setBgInput"
								id="category_description" name="category_description"></textarea></td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Metatitle:</td>
						<td width="70%"><input type="text" value="" name="metatitle"
							id="metatitle" class="setBgInput" style="width: 450px;"  />
						</td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Metakeyword:</td>
						<td width="70%"><input type="text" value="" name="metakeyword"
							id="metakeyword" class="setBgInput" style="width: 450px;"  />
						</td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Metadescription:</td>
						<td width="70%"><input type="text" value="" name="metadesc"
							id="metadesc" class="setBgInput"  style="width: 450px;" />
						</td>
					</tr>
					<tr>
						<td></td>
						<td><input type="submit" name="code_submit" value="Submit" class="btn_bg" /></td>
					</tr>
				</table>
			</form></td>
	</tr>
</table>
</div>
</div>
</article>
<div class="clr-both spacer-10">&nbsp;</div>
<?php $this->load->view('common/cms-footer'); ?>
<script>
function makeURLCategory(obj){
	var str = obj.value;
	str1 = str.toLowerCase();
	str2 = str1.replace(/ /g,"-");
	document.getElementById('category_url').value = str2;
    //document.getElementById('metatitle').value = str+" Coupons - "+str+" Discount Coupons at Couponskart.net";
    //document.getElementById('metakeyword').value = str+", "+str+".com, "+str+" coupons, "+str+" coupon codes, "+str+" discount coupons, "+str+" Promotion codes, discount codes, voucher code, deals, promo codes, offers.";
    //document.getElementById('metadescription').value = str+" Coupons - Shop for Shoes, Clothing, Home and Kitchen, Bags  and Accessories by using "+str+" Discount Coupons at CouponsKart.net";
}
function validateForm(){
	var p = document.getElementById('category_parent').value;
	if(p==""){
		alert("You must choose parent category.");
		document.getElementById('category_parent').focus();
		return false;
		}
	var x = document.getElementById('category_name').value;
	if(x==""){
	alert("Category Name must be filled out.");
	return false;
	}
	var y = document.getElementById('category_url').value;
	if(y==""){
	alert("Category Url must be filled out.");
	return false;
	}
}
</script>